import moment from 'moment';
const ProductListSearchKeys = [
  {
    key: 'purchaseCode',
    label: '采购单编号',
    placeholder: '请输入采购单编号',
    input: true,
    rules: [
      {
        required: false,
      },
    ],
  },
  {
    key: 'orderNo',
    label: '订单编号',
    placeholder: '请输入订单编号',
    input: true,
    rules: [
      {
        required: false,
      },
    ],
  },
  {
    key: 'barcode',
    label: '唯一码编号',
    placeholder: '请输入唯一码编号',
    input: true,
    rules: [
      {
        required: false,
      },
    ],
  },
  // 订单状态（0：待接单；1：已拒单；2：已接单；10：部份入库；20：待发货 21：已发货）
  {
    key: 'status',
    label: '状态',
    placeholder: '请选择状态',
    select: true,
    rules: [
      {
        required: false,
      },
    ],
  },
  {
    key: 'orderTime',
    label: '下单日期',
    placeholder: '请选择下单日期',
    dates: true,
    rules: [
      {
        required: false,
      },
    ],
  },
];
const ProductListColumn = [
  { title: '订单号', width: 50, align: 'center', dataIndex: 'id' },
  { title: '商品数量', width: 110, align: 'center', dataIndex: 'orderNo' },
  {
    title: '订单状态',
    width: 120,
    align: 'center',
    dataIndex: 'status',
    customRender: (v) => {
      return {
        0: '待接单',
        1: '已拒单',
        2: '已接单',
        10: '部份入库',
        20: '待发',
        21: '已发货',
      }[v];
    },
  },
  { title: '下单金额(¥)', width: 120, align: 'center', dataIndex: 'amount' },
  {
    title: '地址',
    width: 120,
    align: 'center',
    dataIndex: 'deliverySn',
    scopedSlots: {customRender: 'onAddress'} ,
  },
  {
    title: '下单时间',
    width: 120,
    align: 'center',
    dataIndex: 'orderTime',
    customRender: (text) => {
      return moment(text).format('YYYY-MM-DD hh:mm:ss');
    },
  },
  {
    title: '接单时间',
    width: 120,
    align: 'center',
    dataIndex: 'receiveTime',
    customRender: (text) => {
      return moment(text).format('YYYY-MM-DD hh:mm:ss');
    },
  },
  {
    title: '发货时间',
    width: 120,
    align: 'center',
    dataIndex: 'deliveryReceiveTime',
    customRender: (text) => {
      return moment(text).format('YYYY-MM-DD hh:mm:ss');
    },
  },
];
const ProductListModalKeys = [
  {
    key: 'lineNumber',
    label: '列数量',
    placeholder: '列数量',
    input: true,
    maxLength: 50,
    rules: [
      {
        required: true,
        message: '列数量',
      },
    ],
  },
  {
    key: 'rowNumber',
    label: '行数量',
    placeholder: '行数量',
    input: true,
    maxLength: 50,
    rules: [
      {
        required: true,
        message: '行数量',
      },
    ],
  },
  {
    key: 'isOpenMerge',
    label: '是否单件归集',
    switcher: true,
    rules: [
      {
        required: true,
        message: '是否单件归集',
      },
    ],
  },
];


const PurchaseExpandColumn = [
    { title: '商品信息',  width:120, align: 'center', scopedSlots: { customRender: 'onGoods' }  }, 
    { title: '系统sku', width: 100, align: 'center', dataIndex: 'sysSkuCode' },
    { title: '订单编号', width: 100, align: 'center', dataIndex: 'sysOrderNo' },
  
    {
      title: '采购单编号',
      width: 100,
      align: 'center',
      dataIndex: 'purchaseCode',
    },
    {
      title: '供应商',
      width: 100,
      align: 'center',
      dataIndex: 'supplySkuCode',
      customRender: (text, record) => {
        return `供应商SPU: ${record.supplySpuCode}, 供应商SKU:  ${record.supplySkuCode}`;
      },
    },
    {
      title: '商品状态',
      width: 60,
      align: 'center',
      // 商品状态 0待接单、1生产中、2待打包、3待出库、4缺图[已补图]、5取消、6拒接
      customRender: (text) => {
        return {
          0: '待接单',
          1: '生产中',
          2: '待打包',
          3: '待出库',
          4: '缺图[已补图]',
          5: '取消',
          6: '拒接',
        }[text];
      },
    },
  ];

export { PurchaseExpandColumn, ProductListSearchKeys, ProductListColumn, ProductListModalKeys };
